# ifndef __NodesExtra_H_
# define __NodesExtra_H_

# include "FVector.h"

//
// Extra attributes for polyline nodes.
//

struct rgnode_t;
struct city_t;
struct zip_t;

	// House numbering data.
struct numbers_t {
	numbers_t () :
		bHasNumbers (0),
		wLeftBefore  (0), wLeftAfter (0),
		wRightBefore (0), wRightAfter (0),
		pCityLeftAfter (NULL), pCityRightAfter (NULL),
		pZipLeftAfter  (NULL), pZipRightAfter (NULL)
	{}

	bool operator == (const numbers_t & _other) const;

	DWORD wLeftBefore  : 31,
	      bHasNumbers  : 1,
	      wLeftAfter   : 30,
	      wLeftParity  : 2;
	DWORD wRightBefore,
	      wRightAfter  : 30,
	      wRightParity : 2;
	city_t * pCityLeftAfter, * pCityRightAfter;
	zip_t  * pZipLeftAfter,  * pZipRightAfter;

	void ReverseSides (numbers_t * _pPrev, bool _bLast);
};

struct point_extra_t {
	point_extra_t () : pRGNode (NULL) {}
	explicit point_extra_t (rgnode_t * _pRGNode) : pRGNode (_pRGNode), bEndNode (false) {}

	// True if neither RG node nor house numbers.
	bool empty () const;

	bool operator == (const point_extra_t & _other) const;

	const rgnode_t * GetRGNode () const {return pRGNode;}
	      rgnode_t * GetRGNode ()       {return pRGNode;}
	void SetRGNode (rgnode_t * _pRGNode, bool _bEndNode);
	void SetRGNode (rgnode_t * _pRGNode, size_t _cPoint, size_t _cPoints) {
		SetRGNode (_pRGNode, _cPoint == 0 || _cPoint + 1 == _cPoints);
	}

	void SetEndNode (bool _bEndNode) {bEndNode = _bEndNode;}

  private:
	// Routing graph node.
	rgnode_t * pRGNode;
	// NOTE: this affect cardinality.
	bool bEndNode;

  public:
	// House numbering data.
	numbers_t Numbers;
};

typedef fvector<point_extra_t> point_extras_t;

bool IsNotEmpty (const point_extras_t & _PointExtras);
bool HasRGNodes (const point_extras_t & _PointExtras);
bool HasNumbers (const point_extras_t & _PointExtras);

# endif // __NodesExtra_H_